package com.jack.webrtcsimple.signal

import android.os.Parcel
import android.os.Parcelable
import android.os.Parcelable.Creator

class MyIceServer : Parcelable {
    @JvmField
    val uri: String?
    @JvmField
    val username: String?
    @JvmField
    val password: String?

    @JvmOverloads
    constructor(uri: String?, username: String? = "", password: String? = "") {
        this.uri = uri
        this.username = username
        this.password = password
    }

    protected constructor(`in`: Parcel) {
        uri = `in`.readString()
        username = `in`.readString()
        password = `in`.readString()
    }

    override fun describeContents(): Int {
        return 0
    }

    override fun writeToParcel(dest: Parcel, flags: Int) {
        dest.writeString(uri)
        dest.writeString(username)
        dest.writeString(password)
    }

    companion object {
        @JvmField
        val CREATOR: Creator<MyIceServer?> = object : Creator<MyIceServer?> {
            override fun createFromParcel(`in`: Parcel): MyIceServer {
                return MyIceServer(`in`)
            }

            override fun newArray(size: Int): Array<MyIceServer?> {
                return arrayOfNulls<MyIceServer>(size)
            }
        }
    }
}
